package com.paipai.mq;

import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ScheduledStartRoundConfig {
    //配置业务交换机
    @Bean
    public DirectExchange  scheduledStartRoundExchange(){
        return  new DirectExchange("scheduledStartRoundExchange");
    }

    //配置业务队列 绑定到死信队列
    @Bean
    public Queue scheduledStartRoundQueue(){
        return QueueBuilder.durable("scheduledStartRoundQueue").deadLetterExchange("scheduledStartRoundDeletterExchange").deadLetterRoutingKey("roukey1").build();
    }
    //业务队列 绑定业务交换机
    @Bean
    public Binding binding2(){
        return BindingBuilder.bind(scheduledStartRoundQueue()).to(scheduledStartRoundExchange()).with("roukey2");
    }

    //配置死信交换机
    @Bean
    public DirectExchange  scheduledStartRoundDeletterExchange(){
        return  new DirectExchange("scheduledStartRoundDeletterExchange");
    }
    //配置死信队列
    @Bean
    public Queue scheduledStartRoundDeletterQueue(){
        return  new Queue("scheduledStartRoundDeletterQueue");
    }
    //死信队列绑定交换机
    @Bean
    public Binding binding1(){
        return BindingBuilder.bind(scheduledStartRoundDeletterQueue()).to(scheduledStartRoundDeletterExchange()).with("roukey1");
    }
}
